<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>待办任务</title>
		<link rel="stylesheet" href="/fk-acti/resource/extjs6.0/classic/theme-crisp/resources/theme-crisp-all.css"></link>
		<script src="/fk-acti/resource/extjs6.0/ext-all.js"></script>
		<script src="/fk-acti/resource/extjs6.0/classic/locale/locale-zh_CN.js"></script>
		<script type="text/javascript" src="/fk-acti/web/resource/js/app.js"></script>
		<link rel="stylesheet" href="/fk-acti/web/resource/css/app.css"></link>
		<script type="text/javascript">
			var dataStore;
			var buttonCode; //用于actioncolumn列编辑，删除按钮的显示
			dataStore = Ext.create("Ext.data.Store", {
				autoLoad: true,
				pageSize: 15,
				sorters: {
					property: "created",
					direction: "DESC"
				},
				proxy: {
					type: "ajax",
					url: "",
					actionMethods: {
						read: "GET" // Store设置请求的方法，与Ajax请求有区别
					},
					reader: {
						type: "json",
						rootProperty: "data", // 数据(不配置的话无法接收数据)，返回的key为data
						root: "result.list",
						totalProperty: "result.pagination.total"
					}
				},
				listeners: {
					"beforeload": function(store, op, options) {
						var params = searchFormPanel.getForm().getValues();
						Ext.apply(dataStore.proxy.extraParams, params);
					}
				}
			}); //#dataStore

			var searchFormPanel = Ext.create("Ext.form.Panel", {
				width: "100%",
				frame: true,
				title: "搜索条件",
				style: {
					marginBottom: "5px"
				},
				bodyStyle: {
					padding: "10px"
				},
				buttonAlign: "center",
				collapsible: true,
				defaultType: "textfield",
				items: [{
					xtype: "container",
					layout: "hbox",
					items: [
						{
							xtype: "combo",
							margin: "10px",
							labelAlign: "right",
							fieldLabel: "委托业务",
							emptyText: "请选择委托业务",
							name: "",
							//allowBlank: false,//是否允许为空
							editable: false,//是否可编辑
							lazyInit: false,//延时初始化下拉列表，默认为true
							triggerAction: 'all',
							valueField: 'value',
							store: new Ext.data.ArrayStore({
								fields: ['value', 'text'],
								data: [
										["1", "123"],
										["0", "456"]
								],
							}),
						},
						{
							fieldLabel: "开始时间",
							labelAlign: "right",
							xtype: "datefield",
							format: "Y-m-d",
							editable: false,
							emptyText: "委托开始时间",
							name: "",
							margin: "10px"
						},
						{
							fieldLabel: "结束时间",
							labelAlign: "right",
							xtype: "datefield",
							format: "Y-m-d",
							editable: false,
							emptyText: "委托结束时间",
							name: "",
							margin: "10px"
						}
					]
				}, ],
				buttons: [{
					text: "搜索",
					icon: jcapp.getIcon("magnifier.png"),
					handler: function() {
						dataStore.reload();
					}
				}, {
					text: "重置",
					icon: jcapp.getIcon("arrow_refresh.png"),
					handler: function() {
						this.up("form").getForm().reset();
					}
				}]
			}); //#searchFormPanel

			var listGridPanel = Ext.create("Ext.grid.Panel", {
				title: "委托任务列表",
				viewConfig:{enableTextSelection:true},
				tbar: [{
						text: "新增",
						xtype: "button",
						icon: jcapp.getIcon("add.png"),
						handler: function() {
							myAdd();
						}
					}
				],
				dockedItems: [{
					xtype: "pagingtoolbar",
					store: dataStore, // same store GridPanel is using
					dock: "bottom",
					displayInfo: true
				}],
				store: dataStore,
				columns: [{
						header: "序号",
						xtype: "rownumberer",
						width: 60,
						align: "center"
					},
					{
						text: "委托业务",
						dataIndex: "",
						flex: 1
					},
					{
						text: "委托人",
						dataIndex: "",
						flex: 1
					},
					{
						text: "被委托人",
						dataIndex: "",
						flex: 1
					},
					{
						text: "委托开始时间",
						dataIndex: "",
						flex: 1
					},
					{
						text: "委托结束时间",
						dataIndex: "",
						flex: 1
					},
					{
						text: "委托原因",
						dataIndex: "",
						flex: 1
					},
					{
						text: "委托状态",
						dataIndex: "",
						flex: 1
					},
					{
						xtype: "actioncolumn",
						width: 100,
						align: "center",
						text: '工作流操作',
						items: [{
								xtype: 'button',
								tooltip: '流程明细',
								icon: jcapp.getIcon("application_view_detail.png"),
								handler: function(grid, rowIndex, colIndex) {
									
								}
							}
						]
					},
					{
						xtype: "actioncolumn",
						width: 100,
						align: "center",
						text: '操作',
						items: [{
								xtype: 'button',
								tooltip: '编辑',
								icon: jcapp.getIcon("application_form_edit.png"),
								handler: function(grid, rowIndex, colIndex) {
									var rec = grid.getStore().getAt(rowIndex);
									var kid = rec.get('kid');
									myEdit(kid);
								}
							},
							{
								xtype: "container"
							},
							{
								xtype: 'button',
								tooltip: '删除',
								icon: jcapp.getIcon("cross.png"),
								handler: function(grid, rowIndex, colIndex) {
									var rec = grid.getStore().getAt(rowIndex);
									var kid = rec.get('kid');
									myDel(kid);
								}
							}
						]
					}
				]
			}); //#listGridPanel

			Ext.onReady(function() {
				searchFormPanel.render(Ext.getBody());
				listGridPanel.render(Ext.getBody());
			});
		</script>
	</head>
	<body>
	
	</body>
	<script type="text/javascript" src="./add.js"></script>
	<script type="text/javascript" src="./delete.js"></script>
	<script type="text/javascript" src="./edit.js"></script>
</html>